package gameObject;

import ui.ImageUtil;

import java.awt.*;
import java.awt.image.BufferedImage;
import java.util.Random;

/*
这里将画出需要抓取的老婆对象
 */
public class Wife {
    BufferedImage loli = ImageUtil.getImage("/Images/狗妈.png");
    BufferedImage dog = ImageUtil.getImage("");
    int w = loli.getWidth();
    int h = loli.getHeight();
    int x = 5;
    int y = 600;
    boolean stop;
    Random random = new Random();
    int falg = 0;
    public Wife(){
    }
    public void drawLoli(Graphics g){
        g.drawImage(loli,x,y,null);
    }
    public void move(){
        if (stop == false){
            if (falg == 0){
                x += 5;
                if ( x > 1000-w){
                    falg = 1;
                }
            }else if (falg == 1){
                x -= 5;
                if (x <= 0){
                    falg = 0;
                }
            }
        }else if (stop == true){
            if (this.y <= 100){
               setX(random.nextInt(990-this.h));
               setY(300+random.nextInt(400));
               stop = false;
            }
        }
    }
    public Rectangle getRect(){
        return new Rectangle(this.x,this.y,this.w,this.h);
    }

    public void setX(int x) {
        this.x = x;
    }

    public void setY(int y) {
        this.y = y;
    }

    public void setStop(boolean stop) {
        this.stop = stop;
    }

    public int getW() {
        return w;
    }

    public int getH() {
        return h;
    }
}
